<?php
namespace classlib;
require 'acl/acl_abstract.cls.php';
use classlib\acl\acl_abstract;
class acl {	
	public static $acl = array();
	/**
	 * 工厂函数获取Acl
	 * @param string $key 获取前台还是后台
	 * @return acl_abstract $acl 缓存实例
	 */
	public static function inst($key='ACLadm') {
		$conf = \classlib\core\config::load($key, false);
		$class= isset($conf['acl'])? $conf['acl']:'cookie';
		if (!isset(self::$acl[$key])) {
			$class = 'classlib\acl\\'.$class;
			self::$acl[$key] = new $class($conf);
		}
		return self::$acl[$key];
	}
}
